# -*- coding: utf-8 -*-
# @Author : HaleShi
# @Time : 2023-07-05
# @File : 1_sign_complete_RSA.py

import base64
import hashlib
import hmac
from urllib.parse import quote_plus


'''
这是str: 1KMrg0dfufc0wpnXEJacEQX1YEUYA0Ja
这是str2: GET
这是str3: 1688543635600
这是str4: v2/isnb-openapi-proxy/auth/router
'''


key = "1KMrg0dfufc0wpnXEJacEQX1YEUYA0Ja"
message = """GET
1688543635600
/v2/isnb-openapi-proxy/auth/router"""
message = message.encode('utf-8')  # 加密内容
key = key.encode('utf-8')  # 加密的key
result = hmac.new(key, message, hashlib.sha1).digest()
print(result)
_sig = base64.b64encode(result).decode()
print(_sig)

result = quote_plus(_sig)
print(result)

# hook获得的sign: 4AhnOzp1Hp92aX7Rh3vj3nUejA4%3D
# 生成的sign签名:  4AhnOzp1Hp92aX7Rh3vj3nUejA4%3D
